<template>
  <div class="home-banner">
    <!-- 使用以封装好的slider组件 传进去sliders-->
    <XtxSlider :sliders="sliders"/>
  </div>
</template>

<script>
import { ref } from 'vue'
import { findBannerAPI } from '@/api/home'
export default {
  name: 'HomeBanner',
  setup () {
    const sliders = ref([])
    // 获取轮播图数据
    async function loadSlidersFn () {
      const res = await findBannerAPI()
      sliders.value = res.result
    }
    loadSlidersFn()
    return {
      sliders
    }
  }
}
</script>

<style scoped lang='less'>
.home-banner {
  width: 1240px;
  height: 500px;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 98;
}
</style>
